<template>
     <div class="container" v-loading="loading">
        <div class="cons zl-dialog">
            <div class="con-title cbtitle-font">班级信息</div>  
            <div class="con-item">
                <div class="lie-title mtitle-font mtitle-color"><span class="red-x">*</span>班级名称</div>
                <el-input class="text-input covered"  minlength="1" maxlength="50"  v-model="classEntity.data.className" placeholder="" clearable></el-input>
            </div>
            <template v-if="classEntity.data.source == 0">
                <div class="con-item">
                <div class="lie-title mtitle-font mtitle-color">学年</div>
                <span class="mtitle-font htitle-color">{{classEntity.data.yearly + "-" + (classEntity.data.yearly+1) + "学年"}}</span>
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color">年级</div>
                    <span class="mtitle-font htitle-color">{{classEntity.data.gradeStr}}</span>
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color">业绩中心</div>
                    <span class="mtitle-font htitle-color">{{classEntity.data.areaName}}</span>
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color">授课地点</div>
                    <span class="mtitle-font htitle-color">{{classEntity.data.officeName}}</span>
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color">产品线</div>
                    <span class="mtitle-font htitle-color">{{classEntity.data.productName}}</span>
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color"><span class="red-x">*</span>额定人数</div>
                    <!-- <el-input class="text-input covered"  v-enter-number  v-model="classEntity.data.totalNum" placeholder="" maxlength="10" clearable></el-input> -->
                    <input-number v-model="classEntity.data.totalNum" :min="0" class="text-input addInputs mtitle-font" :maxLength="10"></input-number>
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color">课酬班型</div>
                    <span class="mtitle-font htitle-color" v-if="classEntity.data.salaryType == 0">标准班</span>
                    <span class="mtitle-font htitle-color" v-else>精粹班</span>
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color">班级类型</div>
                    <span class="mtitle-font htitle-color" v-if="classEntity.data.classType == 0">行政班</span>
                    <span class="mtitle-font htitle-color" v-else>教学班</span>
                    <!-- <el-select placeholder="请选择"  v-model="classEntity.data.classType" @change="changeClassType" clearable>
                        <el-option  label="行政班" :value="0"></el-option>
                        <el-option  label="教学班" :value="1"></el-option>
                    </el-select> -->
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color"><span class="red-x">*</span>班级班型</div>
                    <!-- <span class="mtitle-font htitle-color" v-if="classEntity.data.classLevelType == 632">标准班</span>
                    <span class="mtitle-font htitle-color" v-else-if="classEntity.data.classLevelType == 633">精品班</span>
                    <span class="mtitle-font htitle-color" v-else-if="classEntity.data.classLevelType == 634">精粹班</span> -->
                    <el-select placeholder="请选择" v-model="classEntity.data.classLevelType" clearable>
                        <el-option  v-for="(item, index) in classLevelList.data" :key="index" :label="item.key" :value="item.value"></el-option>
                    </el-select>
                    <!-- <span class="mtitle-font htitle-color">暂无数据</span> -->
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color">试卷类型</div>
                    <span class="mtitle-font htitle-color" v-if="classEntity.data.paperType == 0">北京卷</span>
                    <span class="mtitle-font htitle-color" v-else>全国卷</span>
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color">班级科目</div>
                    <span class="mtitle-font htitle-color" v-if="classEntity.data.subjectType == 1">主三科+物化生</span>
                    <span class="mtitle-font htitle-color" v-else-if="classEntity.data.subjectType == 0">主三科+史地政</span>
                    <span class="mtitle-font htitle-color" v-else-if="classEntity.data.subjectType == 3">主三科+物化生史地政</span>
                    <span class="mtitle-font htitle-color" v-else-if="classEntity.data.subjectType == 2">主三科</span>
                    <span class="mtitle-font htitle-color" v-else-if="classEntity.data.subjectType == 4">物理</span>
                    <span class="mtitle-font htitle-color" v-else-if="classEntity.data.subjectType == 5">化学</span>
                    <span class="mtitle-font htitle-color" v-else-if="classEntity.data.subjectType == 6">生物</span>
                    <span class="mtitle-font htitle-color" v-else-if="classEntity.data.subjectType == 7">历史</span>
                    <span class="mtitle-font htitle-color" v-else-if="classEntity.data.subjectType == 8">地理</span>
                    <span class="mtitle-font htitle-color" v-else-if="classEntity.data.subjectType == 9">政治</span>
                    <!-- <el-select placeholder="请选择"  v-model="classEntity.data.subjectType" clearable>
                        <div v-if="classEntity.data.classType == 0">
                            <el-option  label="主三科" :value="2"></el-option>
                            <el-option  label="主三科+物化生" :value="1"></el-option>
                            <el-option  label="主三科+史地政" :value="0"></el-option>
                        </div>
                        <div v-if="classEntity.data.classType == 1">
                            <el-option  label="物理" :value="4"></el-option>
                            <el-option  label="化学" :value="5"></el-option>
                            <el-option  label="生物" :value="6"></el-option>
                            <el-option  label="历史" :value="7"></el-option>
                            <el-option  label="地理" :value="8"></el-option>
                            <el-option  label="政治" :value="9"></el-option>
                        </div>
                    </el-select> -->
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color"><span class="red-x">*</span>状态</div>
                    <el-select placeholder="请选择" class="editClass" v-model="classEntity.data.status" clearable>
                        <el-option  label="正常" :value="1"></el-option>
                        <el-option  label="停用" :value="0"></el-option>
                    </el-select>
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color">所在教室</div>
                    <el-input class="text-input" v-model="classEntity.data.doorPlate" placeholder="" clearable></el-input>
                    <el-button class="add" style="margin-left: 20px;" @click="addClassroom">添加</el-button>
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color">关联上课周期</div>
                    <span class="mtitle-font htitle-color">{{classEntity.data.courseCycName}}</span>
                </div>
            </template>
            <template v-else>

                <div class="con-item">
                <div class="lie-title mtitle-font mtitle-color"><span class="red-x">*</span>学年</div>
                <el-select placeholder="请选择"  v-model="classEntity.data.yearly">
                    <el-option  v-for="(item, index) in yearlist.data" :key="index" :label="item.key" :value="item.value"></el-option>
                </el-select>
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color"><span class="red-x">*</span>年级</div>
                    <el-select  placeholder="请选择"  v-model="classEntity.data.grade" clearable>
                        <el-option  label="高一" :value="11"></el-option>
                        <el-option  label="高二" :value="14"></el-option>
                        <el-option  label="高三" :value="17"></el-option>
                    </el-select>
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color"><span class="red-x">*</span>业绩中心</div>
                    <el-select placeholder="请选择"  v-model="classEntity.data.areaId" @change="changeArea" clearable>
                        <el-option  v-for="(item, index) in areaList.data" :key="index" :label="item.key" :value="item.value"></el-option>
                    </el-select>
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color"><span class="red-x">*</span>授课地点</div>
                    <el-select placeholder="请选择"  v-model="classEntity.data.officeId" clearable>
                        <el-option  v-for="(item, index) in officeList.data" :key="index" :label="item.key" :value="item.value"></el-option>
                    </el-select>
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color"><span class="red-x">*</span>产品线</div>
                    <el-select placeholder="请选择"  v-model="classEntity.data.productId" clearable>
                        <el-option  v-for="(item, index) in productList.data" :key="index" :label="item.key" :value="item.value"></el-option>
                    </el-select>
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color"><span class="red-x">*</span>额定人数</div>
                    <!-- <el-input class="text-input covered"  v-enter-number  v-model="classEntity.data.totalNum" placeholder="" maxlength="10" clearable></el-input> -->
                    <input-number v-model="classEntity.data.totalNum" :min="0" class="text-input addInputs mtitle-font" :maxLength="10"></input-number>
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color"><span class="red-x">*</span>课酬班型</div>
                    <el-select placeholder="请选择"  v-model="classEntity.data.salaryType" clearable>
                        <el-option  label="标准班" :value="0"></el-option>
                        <el-option  label="精粹班" :value="1"></el-option>
                    </el-select>
                    
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color">班级类型</div>
                    <!-- <span class="mtitle-font htitle-color" v-if="classEntity.data.classType == 0">行政班</span>
                    <span class="mtitle-font htitle-color" v-else>教学班</span> -->
                    <el-select placeholder="请选择"  v-model="classEntity.data.classType" @change="changeClassType" clearable>
                        <el-option  label="行政班" :value="0"></el-option>
                        <el-option  label="教学班" :value="1"></el-option>
                    </el-select>
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color"><span class="red-x">*</span>班级班型</div>
                    <el-select placeholder="请选择"  v-model="classEntity.data.classLevelType" clearable>
                        <el-option  v-for="(item, index) in classLevelList.data" :key="index" :label="item.key" :value="item.value"></el-option>
                    </el-select>
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color"><span class="red-x">*</span>试卷类型</div>
                    <el-select placeholder="请选择"  v-model="classEntity.data.paperType" clearable>
                        <el-option  label="北京卷" :value="0">北京卷</el-option>
                        <el-option  label="全国卷" :value="1">全国卷</el-option>
                    </el-select>
                    
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color">班级科目</div>
                    <!-- <span class="mtitle-font htitle-color" v-if="classEntity.data.subjectType == 0">主三科+物化生</span>
                    <span class="mtitle-font htitle-color" v-else-if="classEntity.data.subjectType == 1">主三科+史地政</span>
                    <span class="mtitle-font htitle-color" v-else-if="classEntity.data.subjectType == 2">主三科</span>
                    <span class="mtitle-font htitle-color" v-else-if="classEntity.data.subjectType == 4">物理</span>
                    <span class="mtitle-font htitle-color" v-else-if="classEntity.data.subjectType == 5">化学</span>
                    <span class="mtitle-font htitle-color" v-else-if="classEntity.data.subjectType == 6">生物</span>
                    <span class="mtitle-font htitle-color" v-else-if="classEntity.data.subjectType == 7">历史</span>
                    <span class="mtitle-font htitle-color" v-else-if="classEntity.data.subjectType == 8">地理</span>
                    <span class="mtitle-font htitle-color" v-else-if="classEntity.data.subjectType == 9">政治</span> -->
                    <el-select placeholder="请选择"  v-model="classEntity.data.subjectType" clearable>
                        <div v-if="classEntity.data.classType == 0">
                            <el-option  label="主三科" :value="2"></el-option>
                            <el-option  label="主三科+物化生" :value="1"></el-option>
                            <el-option  label="主三科+史地政" :value="0"></el-option>
                            <el-option  label="主三科+物化生史地政" :value="3"></el-option>
                        </div>
                        <div v-if="classEntity.data.classType == 1">
                            <el-option  label="物理" :value="4"></el-option>
                            <el-option  label="化学" :value="5"></el-option>
                            <el-option  label="生物" :value="6"></el-option>
                            <el-option  label="历史" :value="7"></el-option>
                            <el-option  label="地理" :value="8"></el-option>
                            <el-option  label="政治" :value="9"></el-option>
                        </div>
                    </el-select>
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color"><span class="red-x">*</span>状态</div>
                    <el-select placeholder="请选择" class="zl-dialog" v-model="classEntity.data.status" clearable>
                        <el-option  label="正常" :value="1"></el-option>
                        <el-option  label="停用" :value="0"></el-option>
                    </el-select>
                  
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color">所在教室</div>
                    <!-- <span class="mtitle-font htitle-color" >{{classEntity.data.doorPlate}}</span> -->
                    <el-input class="text-input" v-model="classEntity.data.doorPlate" placeholder="" clearable></el-input>
                    <el-button class="add" style="margin-left: 20px;" @click="addClassroom">添加</el-button>
                </div>
                <div class="con-item">
                    <div class="lie-title mtitle-font mtitle-color"><span class="red-x" v-if="classEntity.data.classType === 0">*</span>关联上课周期</div>
                    <el-input class="text-input" v-model="classEntity.data.courseCycName" placeholder="" clearable></el-input>
                    <el-button class="add" style="margin-left: 20px;" @click="addCourseCyc">选择</el-button>
                </div>
            </template>
            <div class="div-btn">
                <el-button class="el-btn" type="primary" @click="toSave()" v-if="!saveStatus" :disabled="saveStatus">保存</el-button>
                <el-button class="el-btn" type="primary" v-else>保存</el-button>
                <el-button class="el-btn" @click="toXiao()" :disabled="saveStatus">取消</el-button>
            </div>
        </div>
        <el-dialog title="选择所在教室" dialogDrag v-model="classroomDialog.dialogVisible" width="50%">
            <div class="el-dialog-div">
                <div>
                    <div class="search-title">办公地点</div>
                    <el-select placeholder="请选择"  v-model="classroomDialog.officeId" clearable>
                        <el-option  v-for="(item, index) in officeList.data" :key="index" :label="item.key" :value="item.value"></el-option>
                    </el-select>
                    <!-- <div class="searchbt left-20px"> -->
                        <el-button style="margin-left: 20px" @click="searchClassroom()">查询</el-button>
                    <!-- </div> -->
                </div>
            
                <div class="con-item"></div>
                <el-table
                    :data="classroomDialog.tableData" 
                    border
                    highlight-current-row 
                    class="table" 
                    ref="multipleTable" 
                    :header-cell-style="{background: '#f1f1f1', color: '#333'}" width="100%">
                    <el-table-column prop="doorPlate" header-align="center" align="center" label="教室门牌号"></el-table-column>
                    <el-table-column prop="maxCount" header-align="center"  align="right" label="最大容量" > </el-table-column>
                    <el-table-column prop="floor" header-align="center" align="center" label="楼层"></el-table-column>
                    <el-table-column prop="officeName" header-align="center" align="center" label="办公地点"></el-table-column>
                    <el-table-column  header-align="center" align="left" label="操作" width="90">
                        <template #default="scope">
                            <el-button type="text" icon="el-icon-edit" @click="confirmClassroom(scope.$index, scope.row)">【确认】</el-button>
                        </template>
                    </el-table-column>
                    
                </el-table>
            </div>
          
        </el-dialog>   
            
        <el-dialog title="选择上课周期" dialogDrag v-model="courseCycDialog.dialogVisible" width="70%">
            <div class="el-dialog-div">
                <el-table
                    :data="courseCycDialog.tableData" 
                    border
                    highlight-current-row 
                    class="table" 
                    ref="multipleTable" 
                    :header-cell-style="{background: '#f1f1f1', color: '#333'}" width="100%">
                    <el-table-column prop="name" header-align="center" align="center" label="上课周期名字"></el-table-column>
                    <el-table-column prop="areaName" header-align="center"  align="center" label="上课学区" > </el-table-column>
                    <el-table-column prop="yearly" header-align="center" align="center" label="学年"></el-table-column>
                    <el-table-column prop="productName" header-align="center" align="center" label="三级产品线"></el-table-column>
                    <el-table-column prop="cycle" header-align="center" align="center" label="上课周期"></el-table-column>
                    <el-table-column prop="weakNum" header-align="center" align="right" label="周次数"></el-table-column>
                    <el-table-column  header-align="center" align="left" label="操作" width="90">
                        <template #default="scope">
                        <el-button type="text" icon="el-icon-edit" @click="confirmCourseCyc(scope.$index, scope.row)">选择</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </div>            
        </el-dialog>
    </div>
</template>

<script setup name="editqrzclass">
import { baseUrl } from '@/utils/api';  
import bus from '../../../common/bus';
import inputNumber from '@/components/common/input-number.vue';
import { useStore } from 'vuex'
import { getCurrentInstance, onActivated, reactive , ref, onMounted, watch} from 'vue';
import { onBeforeRouteLeave, useRoute, useRouter } from 'vue-router';
    let route = useRoute();
    let router = useRouter();
    let store = useStore();
    const { ctx, proxy } = getCurrentInstance();
    let currentStatus = ref('');
    let yearlist = reactive({data:[]});
    let areaList= reactive({data:[]});
    let officeList= reactive({data:[]});
    let productList= reactive({data:[]});
    let classroomDialog= reactive({
        dialogVisible:false,
        officeId:'',
        tableData:[]
    });
    let courseCycDialog= reactive({
        dialogVisible:false,
        tableData:[]
    });
    let saveStatus = ref(false);
    let classEntity= reactive({
        data: {
            classId:'',
            className:'',
            gradeStr:'',
            grade:'',
            areaId:'',
            areaName:'',
            officeName:'',
            officeId:'',
            classType:'',
            classLevelType:'',
            subjectType:'',
            status:'',
            masterId:'',
            realname:'',
            yearly:'',
            productId:'',
            productName:'',
            paperType:'',
            classroomId:'',
            doorPlate:'',
            courseCycId:'',
            courseCycName:'',
            salaryType:'',
            totalNum:'',
            source:''
        }       
    });
    let isDel= ref(false);
    let tagsList= ref([]);
    let flg = ref(0);//重复操作
    let classLevelList= reactive({data: []});//班级班型列表
    let loading = ref(false);   
    onMounted(()=>{
        getSessionSearch();
        getDictionList()   
    })
    let getSessionSearch =async ()=>{
        if(JSON.stringify(route.params)!='{}'){
            classEntity.data = {...classEntity.data, ...route.params};
        }else{
            let search = JSON.parse(window.sessionStorage.getItem("vuex"))
            if(JSON.stringify(search.editqrzclass.routeParams)!='{}'){
                classEntity.data = {...classEntity.data, ...search.editqrzclass.routeParams};
            }    
        }
            // if(JSON.stringify(search.editqrzclass.routeParams)!='{}'){
            currentStatus.value = classEntity.data.status;
            // classEntity = search.editqrzclass.routeParams;
            // this.classEntity.classId = search.editqrzclass.routeParams.classId;
            // this.classEntity.className = search.editqrzclass.routeParams.className;
            // this.classEntity.gradeStr = search.editqrzclass.routeParams.gradeStr;
            // this.classEntity.grade = search.editqrzclass.routeParams.grade;
            
            // this.classEntity.areaId = search.editqrzclass.routeParams.areaId;
            // this.classEntity.areaName = search.editqrzclass.routeParams.areaName;
            // this.classEntity.officeName = search.editqrzclass.routeParams.officeName;
            // this.classEntity.officeId = search.editqrzclass.routeParams.officeId;
            // this.classEntity.classType = search.editqrzclass.routeParams.classType;
            // this.classEntity.classLevelType = search.editqrzclass.routeParams.classLevelType;
            // this.classEntity.subjectType = search.editqrzclass.routeParams.subjectType;
            // this.classEntity.status = search.editqrzclass.routeParams.status;
            // this.classEntity.masterId = search.editqrzclass.routeParams.masterId;
            // this.classEntity.realname = search.editqrzclass.routeParams.realname;
            // this.classEntity.yearly = search.editqrzclass.routeParams.yearly;
            // this.classEntity.productId = search.editqrzclass.routeParams.productId;
            if(classEntity.data.productId == 0){
                classEntity.data.productId = '';
            }
            // this.classEntity.productName = search.editqrzclass.routeParams.productName;
            // this.classEntity.paperType = search.editqrzclass.routeParams.paperType;
            // this.classEntity.classroomId = search.editqrzclass.routeParams.classroomId;
            // this.classEntity.doorPlate = search.editqrzclass.routeParams.doorPlate;
            // this.classEntity.courseCycId = search.editqrzclass.routeParams.courseCycId;
            // this.classEntity.courseCycName = search.editqrzclass.routeParams.courseCycName;
            // this.classEntity.salaryType = search.editqrzclass.routeParams.salaryType;
            // this.classEntity.realNum = search.editqrzclass.routeParams.realNum;
            if(classEntity.data.totalNum && (!isNaN(Number(classEntity.data.totalNum)))){
                classEntity.data.totalNum = Number(classEntity.data.totalNum);
                // this.$set(this.classEntity, 'totalNum', Number(classEntity.totalNum))
            }
            // this.classEntity.totalNum = this.$route.params.totalNum;
            // this.classEntity.source = search.editqrzclass.routeParams.source;
            classroomDialog.officeId = classEntity.data.officeId;
            // }
        // }
        await getAreaList();
        await getOfficeListByAreaId(classEntity.data.areaId);
        await getYears();
        await getProductList();
        tagsList.value = store.getters.tagsLists;
    };
    let changeClassType=()=>{
        classEntity.data.subjectType = '';
    };
    let closeTab=()=>{
        for (let i = 0, len = tagsList.value.length; i < len; i++) {
            const item = tagsList.value[i];
            if(item.path === route.fullPath){
                tagsList.value.splice(i, 1);
                store.commit('setTagsLists', tagsList.value);
                break;
            }
        }
    };
    //获取字典表
    let getDictionList=()=>{
        classLevelList.data = [];//班级班型
        let param = new URLSearchParams();
        param.append('type', '162');
        proxy.$post(baseUrl + '/ft/ftchoose/getDictionaryByType.do', param).then(res => {
            //获取菜单列表
            if(res.data.code == 0){
                classLevelList.data = res.data.data;
            }
        }, err => {
            proxy.$message.error(err);
        });
    };
    let getEventData=()=>{
        /* const that = this;
        bus.$on('tags', function(msg){
            that.tagsList = msg;
        }); */
    };
    let getOfficeListByAreaId=(areaId)=>{
        let param = new URLSearchParams();
        param.append("areaId",areaId);
        proxy.$post(baseUrl+'/ft/campus/getOffices.do',param)
            .then(res => {
                officeList.data = res.data.data;
        }, err => {
            proxy.$message.error(err);
        });
    };
    let getYears=()=>{
        //获取学年
        proxy.$post(baseUrl+'/ft/campus/getSchoolYearList.do')
            .then(res => {
                if(res.data.code==0){
                    //获取菜单列表
                    yearlist.data = res.data.data;
                    yearlist.data.forEach(element => {
                        if(element.status != null && element.status == 1){
                            classEntity.data.yearly = element.value;
                        }
                    });
                }else{
                    yearlist.data = [];
                }
        }, err => {
            proxy.$message.error(err);
        });
    };
    let getProductList=()=>{
    //获取产品线列表
        proxy.$post(baseUrl+'/ft/campus/getProductList.do')
            .then(res => {
                if(res.data!=null&&res.data.code==0){
                    //获取菜单列表
                    productList.data = res.data.data;
                }else{
                    productList.data = [];
                }
        }, err => {
            proxy.$message.error(err);
        });
    };
    let getAreaList=()=>{
            //业绩中心
        proxy.$post(baseUrl+'/ft/campus/getSchoolAreaList.do')
            .then(res => {
                areaList.data= res.data.data;
                areaList.data.forEach(item=>{
                if(item.value === classEntity.data.areaId){
                    classEntity.data.areaName = item.key;
                }
    })
        }, err => {
            proxy.$message.error(err);
        });
    };
    let changeArea=()=>{
        officeList.data = [];
        officeId = '';
        if(classEntity.data.areaId){
            let param = new URLSearchParams();
            param.append("areaId",this.classEntity.data.areaId);
                //授课地点
            proxy.$post(baseUrl+'/ft/campus/getOffices.do',param)
                .then(res => {
                    officeList.data = res.data.data;
            }, err => {
                proxy.$message.error(err);
            });
        }
    };
    let addClassroom=()=>{
        if(!classEntity.data.yearly){
            return proxy.$message.error('请先选择学年');
        }

        if(!classEntity.data.officeId){
            return proxy.$message.error('请先选择授课地点');
        }
        if(!classEntity.data.classType && classEntity.data.classType!=0){
            return proxy.$message.error('请先选择班级类型');
        }
        classroomDialog.officeId = classEntity.data.officeId;
        let param = new URLSearchParams();
        param.append("yearly",classEntity.data.yearly);
        param.append("officeId",classroomDialog.officeId);
        param.append("classType",classEntity.data.classType);
        param.append("classId",classEntity.data.classId);
        proxy.$post(baseUrl+'/ft/campus/getClassroom.do',param)
            .then(res => {
                classroomDialog.tableData = res.data.data;
                classroomDialog.dialogVisible = true;
        }, err => {
            return proxy.$message.error(err);
            // this.$message.error('数据请求出错')
        });
    };
    let addCourseCyc=()=>{
        if(!classEntity.data.yearly){
            return proxy.$message.error('请先选择学年');
        }
        if(!classEntity.data.areaId ){
            return proxy.$message.error('请先选择业绩中心');
        }
        let param = new URLSearchParams();
        param.append("yearly",classEntity.data.yearly);
        param.append("areaId",classEntity.data.areaId);
        proxy.$post(baseUrl+'/ft/schoolcourse/getCourseCycleList.do',param)
            .then(res => {
                courseCycDialog.tableData = res.data.data;
                courseCycDialog.dialogVisible = true;
        }, err => {
            proxy.$message.error(err);
            // this.$message.error('数据请求出错')
        });
    };
    let toSave=()=>{
        if(flg.value !=0 ){
            return;
        }else{
            flg.value++;
            saveStatus.value = true;
            if(!classEntity.data.className){
                proxy.$message.error('请填写班级名称');
                saveStatus.value = false;
                flg.value = 0;
                return;
            }
            if(!classEntity.data.yearly ){
                proxy.$message.error('请选择学年');
                saveStatus.value = false;
                flg.value = 0;
                return;
            }
            if(!classEntity.data.grade){
                proxy.$message.error('请选择年级');
                saveStatus.value = false;
                flg.value = 0;
                return;
            }
            if(!classEntity.data.areaId){
                proxy.$message.error('请选择业绩中心');
                saveStatus.value = false;
                flg.value = 0;
                return;
            }
            if(!classEntity.data.officeId){
                proxy.$message.error('请选择授课地点');
                saveStatus.value = false;
                flg.value = 0;
                return;
            }
            if(!classEntity.data.productId){
                proxy.$message.error('请选择产品线');
                saveStatus.value = false;
                flg.value = 0;
                return;
            }
            if(!classEntity.data.totalNum){
                proxy.$message.error('请填写额定人数');
                saveStatus.value = false;
                flg.value = 0;
                return;
            }
            if(!classEntity.data.salaryType && classEntity.data.salaryType!=0){
                proxy.$message.error('请选择课酬班型');
                saveStatus.value = false;
                flg.value = 0;
                return;
            }
            if(!classEntity.data.classType && classEntity.data.classType!=0){
                proxy.$message.error('请选择班级类型');
                saveStatus.value = false;
                flg.value = 0;
                return;
            }
            if(!classEntity.data.classLevelType){
                proxy.$message.error('请选择班级班型');
                saveStatus.value = false;
                flg.value = 0;
                return;
            }
            if(!classEntity.data.className){
                proxy.$message.error('请选择试卷类型');
                saveStatus.value = false;
                flg.value = 0;
                return;
            }
            if(!classEntity.data.subjectType){
                proxy.$message.error('请选择班级科目');
                saveStatus.value = false;
                flg.value = 0;
                return;
            }
            if(classEntity.data.classType === 0){
                if(!classEntity.data.subjectType){
                    proxy.$message.error('请选择班级科目');
                    saveStatus.value = false;
                    flg.value = 0;
                    return;
                }
                if(classEntity.data.subjectType > 3){
                    proxy.$message.error('行政班不能选择单科');
                    saveStatus.value = false;
                    flg.value = 0;
                    return;
                }

            }else if(classEntity.data.subjectType && this.subjectType < 3){
                proxy.$message.error('教学班只能选择单科');
                saveStatus.value = false;
                flg.value = 0;
                return;
            }
            if(!classEntity.data.status){
                proxy.$message.error('请选择状态');
                saveStatus.value = false;
                flg.value = 0;
                return;
            }
            if(classEntity.data.realNum > 0 && classEntity.data.status == 0 && currentStatus == 1){
                classEntity.data.status = 1;
                proxy.$message.error('班级已有学生，不能改为停用状态');
                saveStatus.value = false;
                flg.value = 0;
                return;
            }
            if(classEntity.data.source == 0){
                if(classEntity.data.classType === 0 && !classEntity.data.courseCycId){
                    proxy.$message.error('请关联上课周期');
                    saveStatus.value = false;
                    flg.value = 0;
                    return;
                }
            }
            if(!classEntity.data.doorPlate){
                classEntity.data.classroomId = '';
            }
            if(classEntity.data.classType === 0 &&  !classEntity.data.classroomId){
                proxy.$message.error('请选择所在教室');
                saveStatus.value = false;
                flg.value = 0;
                return;
            }
            if(classEntity.data.classType === 0 &&  !classEntity.data.courseCycName){
                proxy.$message.error('请选择关联上课周期');
                saveStatus.value = false;
                flg.value = 0;
                return;
            }
            loading.value= true;
            let param = new URLSearchParams();
            param.append("classId",classEntity.data.classId);
            param.append("className",classEntity.data.className);
            param.append("classType",classEntity.data.classType);
            param.append("bjbx",classEntity.data.classLevelType);
            param.append("grade",classEntity.data.grade);
            param.append("officeId",classEntity.data.officeId);
            param.append("areaId",classEntity.data.areaId);
            param.append("salaryType",classEntity.data.salaryType);
            param.append("studentNums",classEntity.data.totalNum);
            param.append("yearly",classEntity.data.yearly);
            param.append("productId",classEntity.data.productId);
            param.append("status",classEntity.data.status);
            param.append("paperType",classEntity.data.paperType);
            param.append("source",classEntity.data.source);
            param.append("classroomId",classEntity.data.classroomId);
            // if(this.classEntity.data.source == 0){
                // if(this.classEntity.classType === 0){
                    param.append("courseCycId",classEntity.data.courseCycId);
                // }
            // }
            param.append("subjectType",classEntity.data.subjectType);
            proxy.$post(baseUrl+'/ft/classmanage/saveClass.do',param)
                .then(res => {
                    loading.value = false;
                    if(res.data.code === 0){
                        //保存成功
                        proxy.$message.success("保存成功！")                               
                        // setTimeout(()=>{
                            //返回前一个页面
                            isDel.value = true;
                            saveStatus.value = false;
                            flg.value = 0;
                            closeTab();                          
                            router.push('/showqrzclassmanage');
                        // }, 1000);
                        
                    }else{
                        proxy.$message.error(res.data.msg);
                        saveStatus.value = false;
                        flg.value = 0;
                        //留在当前页面
                    }
            }, err => {
                proxy.$message.error(err);
                // this.$message.error('数据请求出错！')
                saveStatus.value = false;
                flg.value = 0;
                //this.closeTab();
                //返回前一个页面
                router.push('/showqrzclassmanage')
            });
        }
    };
    let confirmClassroom=(index,row)=>{
        classEntity.data.classroomId = row.classroomId;
        classEntity.data.doorPlate = row.doorPlate;
        classroomDialog.dialogVisible = false;

    };
    let confirmCourseCyc=(index,row)=>{
        classEntity.data.courseCycId = row.id;
        classEntity.data.courseCycName = row.name;
        courseCycDialog.dialogVisible = false;
    };
    let searchClassroom=()=>{
        if(!classroomDialog.officeId){
            return proxy.$message.error('请先选择办公地点');
        }
        let param = new URLSearchParams();
        if(classEntity.data.yearly){
            param.append("yearly",classEntity.data.yearly);
        }
        param.append("officeId",classroomDialog.officeId);
        if(classEntity.data.classType){
            param.append("classType",classEntity.data.classType);
        }
        proxy.$post(baseUrl+'/ft/campus/getClassroom.do',param)
            .then(res => {
                classroomDialog.tableData = res.data.data;
                classroomDialog.dialogVisible = true;
        }, err => {
            proxy.$message.error(err);
            // this.$message.error('数据请求出错')
        });
    };
    let toXiao=()=>{
        closeTab();
        router.push('/showqrzclassmanage')
    };
    onActivated(()=>{
        // isUseCache为false时才重新刷新获取数据
        // 因为对list使用keep-alive来缓存组件，所以默认是会使用缓存数据的         
        if(route.meta.isUseCache == true){
            getSessionSearch();
            saveStatus.value = false;
        }
        // 通过这个控制刷新
        route.meta.isUseCache = false;
    })

    onBeforeRouteLeave((to, from ,next)=>{
        if (to.name == 'showqrzclassmanage') {
            // 根据是否删除操作，进行判断是否需要使用缓存数据
            to.meta.isUseCache = isDel.value; 
            isDel.value=false;
        }
        else{
            to.meta.isUseCache = false;
        }       
        next();  
    })
    // export default {
    //     name: 'editqrzclass',
    //     components: {inputNumber},
    //     data() {
    //         return {
    //             currentStatus:'',
    //             yearlist:[],
    //             areaList:[],
    //             officeList:[],
    //             productList:[],
    //             classroomDialog:{
    //                 dialogVisible:false,
    //                 officeId:'',
    //                 tableData:[]
    //             },
    //             courseCycDialog:{
    //                 dialogVisible:false,
    //                 tableData:[]
    //             },
    //             saveStatus:false,
    //             classEntity:{
    //                 classId:'',
    //                 className:'',
    //                 gradeStr:'',
    //                 grade:'',
    //                 areaId:'',
    //                 areaName:'',
    //                 officeName:'',
    //                 officeId:'',
    //                 classType:'',
    //                 classLevelType:'',
    //                 subjectType:'',
    //                 status:'',
    //                 masterId:'',
    //                 realname:'',
    //                 yearly:'',
    //                 productId:'',
    //                 productName:'',
    //                 paperType:'',
    //                 classroomId:'',
    //                 doorPlate:'',
    //                 courseCycId:'',
    //                 courseCycName:'',
    //                 salaryType:'',
    //                 // totalNum:'',
    //                 source:''
    //             },
    //             isDel:false,
    //             tagsList: [],
    //             flg: 0,//重复操作
    //             classLevelList:[]//班级班型列表
    //         }
    //     },
    //     created() {
    //         /* this.currentStatus = this.$route.params.status;
    //         this.classEntity = this.$route.params;
    //         this.classEntity.classId = this.$route.params.classId;
    //         this.classEntity.className = this.$route.params.className;
    //         this.classEntity.gradeStr = this.$route.params.gradeStr;
    //         this.classEntity.grade = this.$route.params.grade;
            
    //         this.classEntity.areaId = this.$route.params.areaId;
    //         this.classEntity.areaName = this.$route.params.areaName;
    //         this.classEntity.officeName = this.$route.params.officeName;
    //         this.classEntity.officeId = this.$route.params.officeId;
    //         this.classEntity.classType = this.$route.params.classType;
    //         this.classEntity.subjectType = this.$route.params.subjectType;
    //         this.classEntity.status = this.$route.params.status;
    //         this.classEntity.masterId = this.$route.params.masterId;
    //         this.classEntity.realname = this.$route.params.realname;
    //         this.classEntity.yearly = this.$route.params.yearly;
    //         this.classEntity.productId = this.$route.params.productId;
    //         if(this.classEntity.productId == 0){
    //             this.classEntity.productId = '';
    //         }
    //         this.classEntity.productName = this.$route.params.productName;
    //         this.classEntity.paperType = this.$route.params.paperType;
    //         this.classEntity.classroomId = this.$route.params.classroomId;
    //         this.classEntity.doorPlate = this.$route.params.doorPlate;
    //         this.classEntity.courseCycId = this.$route.params.courseCycId;
    //         this.classEntity.courseCycName = this.$route.params.courseCycName;
    //         this.classEntity.salaryType = this.$route.params.salaryType;
    //         this.classEntity.realNum = this.$route.params.realNum;
    //         if(this.$route.params.totalNum && (!isNaN(Number(this.$route.params.totalNum)))){
    //             this.$set(this.classEntity, 'totalNum', Number(this.$route.params.totalNum))
    //         }
    //         // this.classEntity.totalNum = this.$route.params.totalNum;
    //         this.classEntity.source = this.$route.params.source;
    //         this.classroomDialog.officeId = this.classEntity.officeId;
    //         if(this.classEntity.source == 1){
    //             this.getAreaList();
    //             this.getOfficeListByAreaId(this.classEntity.areaId);
    //             this.getYears();
    //             this.getProductList();
    //         } */
    //         this.getSessionSearch();
    //         this. getDictionList()           
    //     },
    //     computed: {
    //         ...mapGetters(['tagsLists'])            
    //     },
    //     activated() {
    //         // isUseCache为false时才重新刷新获取数据
    //         // 因为对list使用keep-alive来缓存组件，所以默认是会使用缓存数据的         
    //         if(this.$route.meta.isUseCache == true){
    //             /* this.classEntity = this.$route.params;
    //             this.getAreaList();
    //             this.getOfficeListByAreaId(this.classEntity.areaId);
    //             this.getYears();
    //             this.getProductList(); */
    //             this.getSessionSearch();
    //             this.saveStatus = false;
    //         }
    //         // 通过这个控制刷新
    //         this.$route.meta.isUseCache = false;
    //     },
    //     mounted(){
    //         // this.getEventData();
    //     },
    //     beforeRouteLeave (to, from, next) { 
    //         if (to.name == 'showqrzclassmanage') {
    //             // 根据是否删除操作，进行判断是否需要使用缓存数据
    //             to.meta.isUseCache = this.isDel; 
    //             this.isDel=false;
    //         }
    //         else{
    //             to.meta.isUseCache = false;
    //         }       
    //         next();  
    //     },   
    //     methods: {
    //         ...mapMutations(['setTagsLists']),
    //         getSessionSearch(){
    //             let search = {
    //                 editqrzclass:{
    //                     routeParams: {}
    //                 }
    //             }
    //             if(JSON.stringify(this.$route.params)!='{}'){
    //                 search.editqrzclass.routeParams = this.$route.params;
    //             }else{
    //                 search = JSON.parse(window.sessionStorage.getItem("vuex"))
    //             }
    //                 // if(JSON.stringify(search.editqrzclass.routeParams)!='{}'){
    //                 this.currentStatus = search.editqrzclass.routeParams.status;
    //                 this.classEntity = search.editqrzclass.routeParams;
    //                 this.classEntity.classId = search.editqrzclass.routeParams.classId;
    //                 this.classEntity.className = search.editqrzclass.routeParams.className;
    //                 this.classEntity.gradeStr = search.editqrzclass.routeParams.gradeStr;
    //                 this.classEntity.grade = search.editqrzclass.routeParams.grade;
                    
    //                 this.classEntity.areaId = search.editqrzclass.routeParams.areaId;
    //                 this.classEntity.areaName = search.editqrzclass.routeParams.areaName;
    //                 this.classEntity.officeName = search.editqrzclass.routeParams.officeName;
    //                 this.classEntity.officeId = search.editqrzclass.routeParams.officeId;
    //                 this.classEntity.classType = search.editqrzclass.routeParams.classType;
    //                 this.classEntity.classLevelType = search.editqrzclass.routeParams.classLevelType;
    //                 this.classEntity.subjectType = search.editqrzclass.routeParams.subjectType;
    //                 this.classEntity.status = search.editqrzclass.routeParams.status;
    //                 this.classEntity.masterId = search.editqrzclass.routeParams.masterId;
    //                 this.classEntity.realname = search.editqrzclass.routeParams.realname;
    //                 this.classEntity.yearly = search.editqrzclass.routeParams.yearly;
    //                 this.classEntity.productId = search.editqrzclass.routeParams.productId;
    //                 if(this.classEntity.productId == 0){
    //                     this.classEntity.productId = '';
    //                 }
    //                 this.classEntity.productName = search.editqrzclass.routeParams.productName;
    //                 this.classEntity.paperType = search.editqrzclass.routeParams.paperType;
    //                 this.classEntity.classroomId = search.editqrzclass.routeParams.classroomId;
    //                 this.classEntity.doorPlate = search.editqrzclass.routeParams.doorPlate;
    //                 this.classEntity.courseCycId = search.editqrzclass.routeParams.courseCycId;
    //                 this.classEntity.courseCycName = search.editqrzclass.routeParams.courseCycName;
    //                 this.classEntity.salaryType = search.editqrzclass.routeParams.salaryType;
    //                 this.classEntity.realNum = search.editqrzclass.routeParams.realNum;
    //                 if(search.editqrzclass.routeParams.totalNum && (!isNaN(Number(search.editqrzclass.routeParams.totalNum)))){
    //                     this.$set(this.classEntity, 'totalNum', Number(search.editqrzclass.routeParams.totalNum))
    //                 }
    //                 // this.classEntity.totalNum = this.$route.params.totalNum;
    //                 this.classEntity.source = search.editqrzclass.routeParams.source;
    //                 this.classroomDialog.officeId = this.classEntity.officeId;
    //                 // }
    //             // }
    //             this.getAreaList();
    //             this.getOfficeListByAreaId(this.classEntity.areaId);
    //             this.getYears();
    //             this.getProductList();
    //             this.tagsList = this.tagsLists;
    //         },
    //         changeClassType(){
    //             this.classEntity.subjectType = '';
    //         },
    //         closeTab(){
    //             for (let i = 0, len = this.tagsList.length; i < len; i++) {
    //                 const item = this.tagsList[i];
    //                 if(item.path === this.$route.fullPath){
    //                     this.tagsList.splice(i, 1);
    //                     this.setTagsLists(this.tagsList);
    //                     break;
    //                 }
    //             }
    //         },
    //         //获取字典表
    //         getDictionList(){
    //             this.classLevelList = [];//班级班型
    //             let param = new URLSearchParams();
    //             param.append('type', '162');
    //             this.$axios.post(baseUrl + '/ft/ftchoose/getDictionaryByType.do', param).then(res => {
    //                 //获取菜单列表
    //                 if(res.data.code == 0){
    //                     this.classLevelList = res.data.data;
    //                 }
    //             }, err => {
    //                 this.$message.error(err);
    //             });
    //         },
    //         getEventData(){
    //             /* const that = this;
    //             bus.$on('tags', function(msg){
    //                 that.tagsList = msg;
    //             }); */
    //         },
    //         getOfficeListByAreaId(areaId){
    //             let param = new URLSearchParams();
    //                 param.append("areaId",areaId);
    //             this.$axios.post(baseUrl+'/ft/campus/getOffices.do',param)
    //                 .then(res => {
    //                     this.officeList = res.data.data;
    //             }, err => {
    //                 this.$message.error(err);
    //             });
    //         },
    //         getYears(){
    //             //获取学年
    //             this.$axios.post(baseUrl+'/ft/campus/getSchoolYearList.do')
    //                 .then(res => {
    //                  if(res.data!=null&&res.data.code==0){
    //                       //获取菜单列表
    //                     this.yearlist = res.data.data;
    //                     this.yearlist.forEach(element => {
    //                         if(element.status != null && element.status == 1){
    //                             this.classEntity.yearly = element.value;
    //                         }
    //                     });
    //                  }else{
    //                     this.yearlist = [];
    //                  }
    //                 this.dataListLoading = false;
    //             }, err => {
    //                 this.$message.error(err);
    //             });
    //         },
    //         getProductList(){
    //         //获取产品线列表
    //             this.$axios.post(baseUrl+'/ft/campus/getProductList.do')
    //                 .then(res => {
    //                     if(res.data!=null&&res.data.code==0){
    //                         //获取菜单列表
    //                         this.productList = res.data.data;
    //                     }else{
    //                         this.productList = [];
    //                     }
    //                 this.dataListLoading = false;
    //             }, err => {
    //                 this.$message.error(err);
    //             });
    //         },
    //         getAreaList(){
    //             let _this = this;
    //              //业绩中心
    //             this.$axios.post(baseUrl+'/ft/campus/getSchoolAreaList.do')
    //                 .then(res => {
    //                     _this.areaList = res.data.data;
    //                     _this.areaList.forEach(item=>{
    //                     if(item.value === _this.classEntity.areaId){
    //                         _this.classEntity.areaName = item.key;
    //                     }
    //         })
    //             }, err => {
    //                 this.$message.error(err);
    //             });
    //             _this.dataListLoading = false; 
    //         },
    //         changeArea(){
    //             this.officeList = [];
    //             this.officeId = '';
    //             if(this.classEntity.areaId != null && this.classEntity.areaId != undefined){
    //                 let param = new URLSearchParams();
    //                 param.append("areaId",this.classEntity.areaId);
    //                  //授课地点
    //                 this.$axios.post(baseUrl+'/ft/campus/getOffices.do',param)
    //                     .then(res => {
    //                         this.officeList = res.data.data;
    //                 }, err => {
    //                     this.$message.error(err);
    //                 });
    //                 this.dataListLoading = false;
    //             }
    //         },
    //         addClassroom(){
    //             if(this.classEntity.yearly == null || this.classEntity.yearly === '' || this.classEntity.yearly == undefined){
    //                 this.$message.error('请先选择学年');
    //                 return;
    //             }

    //             if(this.classEntity.officeId == null || this.classEntity.officeId === '' || this.classEntity.officeId == undefined){
    //                 this.$message.error('请先选择授课地点');
    //                 return;
    //             }
    //              if(this.classEntity.classType == null || this.classEntity.classType === '' || this.classEntity.classType == undefined){
    //                 this.$message.error('请先选择班级类型');
    //                 return;
    //             }
    //             this.classroomDialog.officeId = this.classEntity.officeId;
    //             let param = new URLSearchParams();
    //             param.append("yearly",this.classEntity.yearly);
    //             param.append("officeId",this.classroomDialog.officeId);
    //             param.append("classType",this.classEntity.classType);
    //             param.append("classId",this.classEntity.classId);
    //             this.$axios.post(baseUrl+'/ft/campus/getClassroom.do',param)
    //                 .then(res => {
    //                     this.classroomDialog.tableData = res.data.data;
    //                     this.classroomDialog.dialogVisible = true;
    //             }, err => {
    //                 this.$message.error(err);
    //                 this.$message.error('数据请求出错')
    //             });
    //         },
    //         addCourseCyc(){
    //             if(this.classEntity.yearly == null || this.classEntity.yearly === '' || this.classEntity.yearly == undefined){
    //                 this.$message.error('请先选择学年');
    //                 return;
    //             }
    //             if(this.classEntity.areaId == null || this.classEntity.areaId === '' || this.classEntity.areaId == undefined){
    //                 this.$message.error('请先选择业绩中心');
    //                 return;
    //             }
    //             let param = new URLSearchParams();
    //             param.append("yearly",this.classEntity.yearly);
    //             param.append("areaId",this.classEntity.areaId);
    //             this.$axios.post(baseUrl+'/ft/schoolcourse/getCourseCycleList.do',param)
    //                 .then(res => {
    //                     this.courseCycDialog.tableData = res.data.data;
    //                     this.courseCycDialog.dialogVisible = true;
    //             }, err => {
    //                 this.$message.error(err);
    //                 this.$message.error('数据请求出错')
    //             });
    //         },
    //         toSave(){
    //             if(this.flg !=0 ){
    //                 return;
    //             }else{
    //                 this.flg++;
    //                 this.saveStatus = true;
    //                 if(this.classEntity.className == '' || this.classEntity.className == null || this.classEntity.className == undefined){
    //                     this.$message.error('请填写班级名称');
    //                     this.saveStatus = false;
    //                     this.flg = 0;
    //                     return;
    //                 }
    //                 if(this.classEntity.yearly == '' || this.classEntity.yearly == null || this.classEntity.yearly == undefined){
    //                     this.$message.error('请选择学年');
    //                     this.saveStatus = false;
    //                     this.flg = 0;
    //                     return;
    //                 }
    //                 if(this.classEntity.grade == '' || this.classEntity.grade == null || this.classEntity.grade == undefined){
    //                     this.$message.error('请选择年级');
    //                     this.saveStatus = false;
    //                     this.flg = 0;
    //                     return;
    //                 }
    //                 if(this.classEntity.areaId == '' || this.classEntity.areaId == null || this.classEntity.areaId == undefined){
    //                     this.$message.error('请选择业绩中心');
    //                     this.saveStatus = false;
    //                     this.flg = 0;
    //                     return;
    //                 }
    //                 if(this.classEntity.officeId == '' || this.classEntity.officeId == null || this.classEntity.officeId == undefined){
    //                     this.$message.error('请选择授课地点');
    //                     this.saveStatus = false;
    //                     this.flg = 0;
    //                     return;
    //                 }
    //                 if(this.classEntity.productId == '' || this.classEntity.productId == null || this.classEntity.productId == undefined){
    //                     this.$message.error('请选择产品线');
    //                     this.saveStatus = false;
    //                     this.flg = 0;
    //                     return;
    //                 }
    //                 if(this.classEntity.totalNum == '' || this.classEntity.totalNum == null || this.classEntity.totalNum == undefined){
    //                     this.$message.error('请填写额定人数');
    //                     this.saveStatus = false;
    //                     this.flg = 0;
    //                     return;
    //                 }
    //                 if(this.classEntity.salaryType === '' || this.classEntity.salaryType == null || this.classEntity.salaryType == undefined){
    //                     this.$message.error('请选择课酬班型');
    //                     this.saveStatus = false;
    //                     this.flg = 0;
    //                     return;
    //                 }
    //                 if(this.classEntity.classType === '' || this.classEntity.classType == null || this.classEntity.classType == undefined){
    //                     this.$message.error('请选择班级类型');
    //                     this.saveStatus = false;
    //                     this.flg = 0;
    //                     return;
    //                 }
    //                 if(this.classEntity.classLevelType === '' || this.classEntity.classLevelType == null || this.classEntity.classLevelType == undefined){
    //                     this.$message.error('请选择班级班型');
    //                     this.saveStatus = false;
    //                     this.flg = 0;
    //                     return;
    //                 }
    //                 if(this.classEntity.className === '' || this.classEntity.className == null || this.classEntity.className == undefined){
    //                     this.$message.error('请选择试卷类型');
    //                     this.saveStatus = false;
    //                     this.flg = 0;
    //                     return;
    //                 }
    //                 if(this.classEntity.subjectType === '' || this.classEntity.subjectType === null || this.classEntity.subjectType === undefined){
    //                     this.$message.error('请选择班级科目');
    //                     this.saveStatus = false;
    //                     this.flg = 0;
    //                     return;
    //                 }
    //                 if(this.classEntity.classType === 0){
    //                     if(this.classEntity.subjectType === '' || this.classEntity.subjectType == null || this.classEntity.subjectType == undefined){
    //                         this.$message.error('请选择班级科目');
    //                         this.saveStatus = false;
    //                         this.flg = 0;
    //                         return;
    //                     }
    //                     if(this.classEntity.subjectType > 3){
    //                         this.$message.error('行政班不能选择单科');
    //                         this.saveStatus = false;
    //                         this.flg = 0;
    //                         return;
    //                     }

    //                 }else if(!(this.classEntity.subjectType === '' || this.classEntity.subjectType === null || this.classEntity.subjectType === undefined) && this.subjectType < 3){
    //                     this.$message.error('教学班只能选择单科');
    //                     this.saveStatus = false;
    //                     this.flg = 0;
    //                     return;
    //                 }
    //                 if(this.classEntity.status === '' || this.classEntity.status == null || this.classEntity.status == undefined){
    //                     this.$message.error('请选择状态');
    //                     this.saveStatus = false;
    //                     this.flg = 0;
    //                     return;
    //                 }
    //                 if(this.classEntity.realNum > 0 && this.classEntity.status == 0 && this.currentStatus == 1){
    //                     this.classEntity.status = 1;
    //                     this.$message.error('班级已有学生，不能改为停用状态');
    //                     this.saveStatus = false;
    //                     this.flg = 0;
    //                     return;
    //                 }
    //                 if(this.classEntity.source == 0){
    //                     if(this.classEntity.classType === 0 && (this.classEntity.courseCycId === '' || this.classEntity.courseCycId == null || this.classEntity.courseCycId == undefined)){
    //                         this.$message.error('请关联上课周期');
    //                         this.saveStatus = false;
    //                         this.flg = 0;
    //                         return;
    //                     }
    //                 }
    //                 if(this.classEntity.doorPlate == ''||this.classEntity.doorPlate == null || this.classEntity.doorPlate == undefined){
    //                     this.classEntity.classroomId = '';
    //                 }
    //                 if(this.classEntity.classType === 0 && ( this.classEntity.classroomId == '' || this.classEntity.classroomId === null || this.classEntity.classroomId === undefined)){
    //                     this.$message.error('请选择所在教室');
    //                     this.saveStatus = false;
    //                     this.flg = 0;
    //                     return;
    //                 }
    //                 if(this.classEntity.classType === 0 && ( this.classEntity.courseCycName == '' || this.classEntity.courseCycName === null || this.classEntity.courseCycName === undefined)){
    //                     this.$message.error('请选择关联上课周期');
    //                     this.saveStatus = false;
    //                     this.flg = 0;
    //                     return;
    //                 }
    //                 let param = new URLSearchParams();
    //                 param.append("classId",this.classEntity.classId);
    //                 param.append("className",this.classEntity.className);
    //                 param.append("classType",this.classEntity.classType);
    //                 param.append("bjbx",this.classEntity.classLevelType);
    //                 param.append("grade",this.classEntity.grade);
    //                 param.append("officeId",this.classEntity.officeId);
    //                 param.append("areaId",this.classEntity.areaId);
    //                 param.append("salaryType",this.classEntity.salaryType);
    //                 param.append("studentNums",this.classEntity.totalNum);
    //                 param.append("yearly",this.classEntity.yearly);
    //                 param.append("productId",this.classEntity.productId);
    //                 param.append("status",this.classEntity.status);
    //                 param.append("paperType",this.classEntity.paperType);
    //                 param.append("source",this.classEntity.source);
    //                 param.append("classroomId",this.classEntity.classroomId);
    //                 // if(this.classEntity.source == 0){
    //                     // if(this.classEntity.classType === 0){
    //                         param.append("courseCycId",this.classEntity.courseCycId);
    //                     // }
    //                 // }
    //                 param.append("subjectType",this.classEntity.subjectType);
    //                 this.$axios.post(baseUrl+'/ft/classmanage/saveClass.do',param)
    //                     .then(res => {
    //                         if(res.data.code === 0){
    //                             //保存成功
    //                             this.$message.success("保存成功！")                               
    //                             setTimeout(()=>{
    //                                 //返回前一个页面
    //                                 this.closeTab();
    //                                 this.isDel = true;
    //                                 this.saveStatus = false;
    //                                 this.flg = 0;
    //                                 this.$router.push('/showqrzclassmanage')
    //                             }, 1000);
                              
    //                         }else{
    //                             this.$message.error(res.data.msg);
    //                             this.saveStatus = false;
    //                             this.flg = 0;
    //                             //留在当前页面
    //                         }
    //                 }, err => {
    //                     this.$message.error(err);
    //                     this.$message.error('数据请求出错！')
    //                     this.saveStatus = false;
    //                     this.flg = 0;
    //                     //this.closeTab();
    //                     //返回前一个页面
    //                     this.$router.push('/showqrzclassmanage')
    //                 });
    //             }
    //         },
    //         confirmClassroom(index,row){
    //             this.classEntity.classroomId = row.classroomId;
    //             this.classEntity.doorPlate = row.doorPlate;
    //             this.classroomDialog.dialogVisible = false;

    //         },
    //         confirmCourseCyc(index,row){
    //             this.classEntity.courseCycId = row.id;
    //             this.classEntity.courseCycName = row.name;
    //             this.courseCycDialog.dialogVisible = false;
    //         },
    //         searchClassroom(){
    //              if(this.classroomDialog.officeId == null || this.classroomDialog.officeId == '' || this.classroomDialog.officeId == undefined){
    //                 this.$message.error('请先选择办公地点');
    //                 return;
    //             }
    //             let param = new URLSearchParams();
    //             if(this.classEntity.yearly != null && this.classEntity.yearly != undefined){
    //                 param.append("yearly",this.classEntity.yearly);
    //             }
    //             param.append("officeId",this.classroomDialog.officeId);
    //             if(this.classEntity.classType != null && this.classEntity.classType != undefined){
    //                 param.append("classType",this.classEntity.classType);
    //             }
    //             this.$axios.post(baseUrl+'/ft/campus/getClassroom.do',param)
    //                 .then(res => {
    //                     this.classroomDialog.tableData = res.data.data;
    //                     this.classroomDialog.dialogVisible = true;
    //             }, err => {
    //                 this.$message.error(err);
    //                 this.$message.error('数据请求出错')
    //             });
    //         },
    //         toXiao(){
    //             this.closeTab();
    //             this.$router.push('/showqrzclassmanage')
    //         }
    //     }
    // }

</script>

<style scoped>
    .cons{
        width: 80%;
        margin: 0 auto;
        border: 1px solid #e8e8e8;
    }
    .con-title{
        padding-bottom: 10px;
        padding-top: 20px;
        text-align: center;
    }
    .lie-title{
        width: 120px;
        display: inline-block;
        text-align: right;
        margin-right:15px;
    }
    .con-item{
        margin-top: 20px;
    }
    .red-x{
        color: red;
        margin-right: 8px;
    }
    .text-input{
        width: 215px;
    }
    .select{
        width: 30%;
    }
    .ts-text{
        color: red;
        font-size: 12px;
        margin-left: 100px;
        margin-top: 10px;
    }
    .div-btn{
        width: 100%;
        text-align: center;
        padding-bottom: 10px;
    }
    .el-btn{
        width: 100px;
        margin-top: 30px;
    }
    .editor{
        width: 80%;
        display: inline-block;
    }
    .el-add{
        font-size: 18px;
    }
    .left-20px{
       margin-left: 20px; 
    }
    .zl-dialog .el-select.el-select--small, 
    .zl-dialog .el-date-editor--date, 
    .zl-dialog .covered .el-input--small, 
    .zl-dialog .el-input{
        width: 70% !important;
    }
    .covered .el-input__suffix{
        right: 40px !important;
    }
    .addInputs{
        width: 70%;
        display: inline-block;
    }
    .el-dialog-div{
        height: 320px;
        overflow-y: auto;
    }
</style>
<style>
    .ql-container{
        min-height: 200px;
    }
</style>